//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.model.vo
{
	import mx.collections.ArrayCollection;
	import mx.controls.listClasses.ListBase;
	
	import reader.core.ReaderError;
	
	[Bindable]
	public class SelectAbleVO
	{
		public var isSelected:Boolean;
		public var icon:Class;
		
		//----------------------------------------------------------------------------
		//
		// filter function
		//
		//----------------------------------------------------------------------------
		
		public static function isSelectedFunction(element:SelectAbleVO, index:int, arr:Array):void 
		{
        	element.isSelected = true;
    	}
        	
    	public static function notSelectedFunction(element:SelectAbleVO, index:int, arr:Array):void 
		{
        	element.isSelected = false;
    	}
    	
    	public static function filterListData(list:ListBase):void
    	{
    		if(list && list.dataProvider is ArrayCollection)
    			list.dataProvider.source.forEach(notSelectedFunction);
    		list.selectedItems.forEach(isSelectedFunction);		
    	}

	}
}